1. Field of the Invention
The invention relates to a memory access method, and in particular to a memory access method in which a picture is divided into several macroblocks and stored in the memory block by block, and the top and bottom field of each macroblock are separately stored in different consecutive addressing areas of pages. According to this method, the DRAM burst mode can be utilized for both frame and field access to substantially increase effective DRAM bandwidth. In this way, the drawbacks in both the frame-organized method and field-organized method can be avoided.
2. Description of the Related Art
In current video decoding systems, such as MPEG-I, MPEG-II, H.261, and the like, the inter-frame compression technology is often used to reduce the data redundancies between pictures so as to obtain a better data compression result. The systems all involve algorithms based on a common core of the compression technology, such as predictive and/or inter-polative inter-picture encoding. The motion compensation is block-based, and each prediction block has associated motion vectors. The motion compensation operation involves reading the prediction block from a reference picture according to the motion vectors. A reference picture is used for forward and backward prediction. The reference picture can be either a reference-frame-picture, or a reference-field-picture having one reference-top-field-picture and one reference-bottom-field-picture. A reference-frame-picture is encoded as a frame picture, and contains lines of spatial information of a video signal. These lines of spatial information contain samples starting from the uppermost of the picture continuing through successive lines to the downmost of the picture. A reference-field-picture is encoded as a field picture, and is the assembly of alternate lines of a frame. Each line of a reference-top-field-picture is spatially located immediately above the corresponding line of the reference-bottom-field-picture. The reference pictures are quite large and typically stored in dynamic random access memories (DRAMs). The DRAM has several memory banks, and each bank includes many memory pages. However, there is a problem of cross-page penalty in the DRAM. The DRAM can be addressed by the column address and the row address, and a different row address is addressed to a different page. Before reading the data in different pages, it is necessary to activate and pre-charge the to-be-read page. Consequently, reading the data from different pages may slow down the speed for the video decoder to read the reference picture. In order to mitigate the cross-page penalty, it is desired to store each prediction block into fewer pages during data accessing, and then to access data in a page-by-page manner.
The increasing demand for more memory bandwidth requires the use of sophisticated memory devices like DDR SDRAM or RDRAM (Rambus DRAM). To obtain high performance, these devices have two main features: the burst-access mode and the multiple-bank architecture. The burst-access mode enables access to a number of consecutive addressing data words by simply giving a burst read command or a burst write command. The burst read command or burst write command includes a burst-starting-address indicating the starting address of the data to be retrieved, and a burst-access-length indicating the size of the data to be retrieved. The multiple-bank architecture has the feature that each bank can be accessed alternately. A burst access operation majorly includes three steps. Firstly, issue a row-activation command so as to copy the row data of a designated bank into the sense amplifier. Secondly, issue a burst access command to fetch data of the size indicated in the burst-access-length from the sense amplifier and then send the fetched data to the data bus. Thirdly, access data stored in other columns but in the same row by changing only the column address without issuing any additional row-activation command. Since these steps are pipelined with an external clock, SDRAM or RDRAM can operate at higher clock frequency, and commands issued to different banks can be overlapped. For example, a row-activation command of one bank can be overlapped with burst access operations of another bank. So the number of cycles for the row-activiation can be reduced. Therefore, if we can access the reference picture by burst access mode, the effective DRAM bandwidth can be greatly boosted up.
In a typical video decoding system, a reference picture has two fields, i.e., top field and bottom field. The top field includes all the odd number data rows in the reference picture, while the bottom field includes all the even number data rows in the reference picture. The top field and the bottom field can be samples retrieved at the same or different time instant in the time axis. To achieve the best compression ratio and reconstructed image quality, frame-based prediction and field-based prediction mode are used. The frame-based prediction is a prediction mode using both the top field and bottom field of the reference picture, and the field-based prediction is a prediction mode using only one field of the reference picture. In the case that the top and bottom fields of the frame are sampled at a same time instant, frame-based prediction is used. In the case that the top and bottom fields of the frame are sampled at a different time instant, field-based prediction is used. In another aspect, since the reference picture can be divided into many macroblocks, each macroblock includes a portion of the top field and a portion of the bottom field. The specific portion of the top field belonging to a macroblock will be described as “the corresponding top field of the macroblock” in the following description. Similarly, the specific portion of the bottom field belonging to a macroblock will be described as “the corresponding bottom field of the macroblock.”
To perform the motion compensation operation in a frame-based prediction, the frame access method that concurrently accesses both the top field and bottom field is used. On the other hand, to perform the motion compensation in a field-based prediction, the field access method that accesses either the top field or the bottom field is used.
FIG. 1 is a diagram showing a conventional arrangement wherein the reference picture is stored in the memory by a frame-organized storage method. In the frame-organized storage method, a reference-frame-picture is directly stored in a frame buffer 1. On the other hand, the reference-top-field-picture and the reference-bottom-field-picture are interlaced and combined as a frame structure, and then stored into a frame buffer 1. FIG. 1 illustrates a page 10 stored in a frame buffer 1. Please note that in this drawing, each address is directed to double words (4 bytes) of data. The picture has 720*576 pixels, and contains 720*576 bytes of data if each pixel is represented by one byte of data, so the frame buffer 1 contains 720*576 bytes of data. Each page has 32*32=1,024 bytes of data, and includes four 16*16 bytes macroblocks 11, 12, 13 and 14. As described above, each macroblock includes a portion of the top and bottom fields, wherein the shadowed areas denote the bottom field in this drawing. There are drawbacks for this conventional frame-organized storage method. For example, for accessing the top or bottom field in a field-based prediction, the above-mentioned DRAM burst-access mode can't be used since the accessed addresses are not consecutively located. For example, if we want to read the top field of the macroblock 11 in FIG. 1, the read addresses are not consecutively located, we can't use DRAM burst access mode to read these data. Hence, the effective DRAM bandwidth will be substantially decreased.
FIG. 2 is a diagram showing a conventional arrangement wherein the reference picture is stored in the memory by a field-organized storage method. In the field-organized storage method, the reference-top-field-picture and the reference-bottom-field-picture are respectively stored in different field buffers. On the other hand, the reference-frame-picture is composed of a reference-top-field-picture and a reference-bottom-field-picture, which are stored in different field buffers. Also, assuming the picture has 720*576 pixels, and contains 720*576 bytes of data if each pixel is represented by one byte of data, each of the field buffers 2 and 2′ has 720*288 bytes of data. The field buffers 2 and 2′ are different portions of a memory. The page 20 has 32*32 bytes of data, and stores eight portions of the top field, indicated as 21 to 28 in FIG. 2(A); the page 20′ has also 32*32 bytes of data, and stores eight portions of the bottom field, indicated as 21′ to 28′ in FIG. 2(B). In the field-organized method, since the top and bottom fields are stored in different field buffers 2, 2′, the corresponding top and bottom fields of each macroblock will be stored in different pages. Although the field-organized method can avoid the drawbacks of the frame-organized method, another disadvantage occurs in the frame access of a frame-based prediction. When a system perform the frame access in a frame-based prediction so as to fetch both the top and bottom field data, cross page penalties will occur since the top and bottom fields of each macroblock are stored in different pages. Hence, the effective DRAM bandwidth of field-organized method will be lowered due to the inevitable cross page penalties of frame access.